package com.example.firstjavamqtt.model.base;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.Date;

@ApiModel(value = "设备")
@TableName("device_info")
@Data
@ToString
@Component
public class Device implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "数据库id")
    @TableId(type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "设备注册id")
    @TableField("device_id")
    protected String deviceId;

    @ApiModelProperty(value = "设备类型")
    @TableField("device_type")
    protected String deviceType;

    @ApiModelProperty(value = "注册时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("register_date")
    protected Date registerDate;

    @ApiModelProperty(value = "最后一次在线时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("lastonline_date")
    protected Date lastOnlineDate;

    @ApiModelProperty(value = "是否在线")
    @TableField("online")
    protected boolean online;

    @ApiModelProperty(value = "位置")
    @TableField("location")
    protected String location;
}
